# s1 = "Welcome to Python"
# s2 = s1
# s3 = "Welcome to Python"
# s4 = 'to'
# print(s3 == s1)
# print(id(s1) == id(s2))
# print(id(s1) == id(s3))
# print(id(s1))
# print(id(s2))
# print(s1.rfind('o'))
# print(s1.upper())
# print(s1.startswith('o'))
# print(s1.find(s4))
# print(s1.endswith('o'))
# print(s1[4])
# print(s1[4:8])
# print(4 * s4)
# print(s1 < s4)
# print(max(s1))
# print(s1.isalpha())
# print(s1 + s1)
# print(chr(100))
# print(ord('A'))
#十六进制转十进制
# s = input()
# total_sum = 0
# for i in range(len(s)):
#     if s[len(s) - 1 - i].isdigit():
#         total_sum += int(s[len(s) - 1 - i]) * 16 ** i
#     else:
#         total_sum += (ord(s[len(s) - 1 - i]) - 87) * 16 ** i
# print(total_sum)
# s = input()
# s = s[::-1]
# the_sum = 0
# for i in range(len(s)):
#     if s[i].isdigit():
#         the_sum += int(s[i]) * 16 ** i
#     else:
#         the_sum += (ord(s[i]) - 87) * 16 ** i
# print(the_sum)
#十进制转十六进制
# num = int(input())
# s = ""
# while num != 0:
#     temp = num % 16
#     if temp > 9:
#         s = chr(temp + 87) + s
#     else:
#         s = str(temp) + s
#     num //= 16
# print(s)

#密码检测
#思路1 用字典
"""
def password(s):
    if len(s) < 8:
        return False
    dic = dict()
    dic = {'english':0, 'number':0, 'other':0}
    for letter in s:
        #判断这个字符是否是字母
        if letter.isalpha():
            dic['english'] += 1
        #判断这个字符是否是数字
        elif letter.isdigit():
            dic['number'] += 1
        else:
            dic['other'] += 1
    if dic['english'] < 2 or dic['number'] < 2 or dic['other'] > 0:
        return False
    return True
s = input()
if password(s):
    print('Yes')
else:
    print('No')
"""
#思路二用集合
"""
def password(s):
    if len(s) < 8:
        return False
    #把源字符串生成集合
    s = set(s)
    letter = set()
    #将letter集合中添加所有的大小写字母
    for i in range(26):
        letter.add(chr(i + 97))
        letter.add(chr(i + 65))
    #num集合里面添加所有可以输入的数字
    num = set('123456789')
    #取差集，确保集合s中只有字母和数字，否则就返回False
    if len(s - (letter | num)) > 0:
        return False
    #最后取交集确定集合s中至少有字母2个和数字2个
    return len(s & letter) >= 2 and len(s & num) >= 2
s = input()
if password(s):
    print('Yes')
else:
    print('No')
"""
#相似词
"""
遍历word1
然后挨个判断每个字母是否在word2中
"""
# word1 = input()
# word2 = input()
# for letter in word1:
#     if letter in word2:
#         print('Yes')
#         break
# else:
#     print('No')
#思路2 集合
# word1 = set(input().lower())
# word2 = set(input().lower())
# #有交集说明有相同字母
# if word1 & word2:
#     print('YES')
# else:
#     print('NO')
#找出基因
def find_gene(s):
    start = s.find(ATG)
    last = ['TAG', 'TAA', 'TGA']
    for mapper in last:
        if mapper in s:
            end = s.find(mapper)
            break
        

    

s = input()
find_gene(s)



